

package io.renren;

import com.alibaba.fastjson.JSON;
import io.renren.modules.category.entity.*;
import net.sourceforge.pinyin4j.PinyinHelper;
import net.sourceforge.pinyin4j.format.HanyuPinyinOutputFormat;
import net.sourceforge.pinyin4j.format.HanyuPinyinToneType;
import net.sourceforge.pinyin4j.format.exception.BadHanyuPinyinOutputFormatCombination;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

import java.util.*;


@RunWith(SpringRunner.class)
@SpringBootTest
public class CategoryTest807 {

    /**
     * 测试拼音
     */
    @Test
    public void testGetCode() {
        String brandJson = "[{\"id\":101,\"name\":\"女士\",\"sort\":1,\"initialList\":[{\"name\":\"A\",\"consumerId\":101,\"sort\":1,\"brandList\":[{\"name\":\"A-COLD-WALL*\",\"initialId\":1001,\"initialCode\":\"A\",\"consumerId\":101,\"sort\":1},{\"name\":\"ANTEPRIMA\",\"initialId\":1001,\"initialCode\":\"A\",\"consumerId\":101,\"sort\":1},{\"name\":\"ACNE STUDIOS\",\"initialId\":1001,\"initialCode\":\"A\",\"consumerId\":101,\"sort\":1}]},{\"name\":\"B\",\"consumerId\":101,\"sort\":2,\"brandList\":[{\"name\":\"BVLGARI\",\"initialId\":1002,\"initialCode\":\"B\",\"consumerId\":101,\"sort\":1},{\"name\":\"BERLUTI\",\"initialId\":1002,\"initialCode\":\"B\",\"consumerId\":101,\"sort\":1},{\"name\":\"BURBERRY\",\"initialId\":1002,\"initialCode\":\"B\",\"consumerId\":101,\"sort\":1},{\"name\":\"BALENCIAGA\",\"initialId\":1002,\"initialCode\":\"B\",\"consumerId\":101,\"sort\":1},{\"name\":\"BALLY\",\"initialId\":1002,\"initialCode\":\"B\",\"consumerId\":101,\"sort\":1},{\"name\":\"BE@RBRICK\",\"initialId\":1002,\"initialCode\":\"B\",\"consumerId\":101,\"sort\":1},{\"name\":\"布克兄弟(BROOKS BROTHERS)\",\"initialId\":1002,\"initialCode\":\"B\",\"consumerId\":101,\"sort\":1},{\"name\":\"BACCARAT\",\"initialId\":1002,\"initialCode\":\"B\",\"consumerId\":101,\"sort\":1},{\"name\":\"BV\",\"initialId\":1002,\"initialCode\":\"B\",\"consumerId\":101,\"sort\":1},{\"name\":\"BUBEN & ZORWEG\",\"initialId\":1002,\"initialCode\":\"B\",\"consumerId\":101,\"sort\":1}]},{\"name\":\"C\",\"consumerId\":101,\"sort\":3,\"brandList\":[{\"name\":\"CARRIERE FRERES\",\"initialId\":1003,\"initialCode\":\"C\",\"consumerId\":101,\"sort\":0},{\"name\":\"卡地亚（Cartier）\",\"initialId\":1003,\"initialCode\":\"C\",\"consumerId\":101,\"sort\":0},{\"name\":\"culti\",\"initialId\":1003,\"initialCode\":\"C\",\"consumerId\":101,\"sort\":0},{\"name\":\"celine\",\"initialId\":1003,\"initialCode\":\"C\",\"consumerId\":101,\"sort\":1},{\"name\":\"卓诺迪（Cerruti 1881）\",\"initialId\":1003,\"initialCode\":\"C\",\"consumerId\":101,\"sort\":1},{\"name\":\"昆仑表（CORUM）\",\"initialId\":1003,\"initialCode\":\"C\",\"consumerId\":101,\"sort\":1},{\"name\":\"蔻驰（COACH）\",\"initialId\":1003,\"initialCode\":\"C\",\"consumerId\":101,\"sort\":1},{\"name\":\"加拿大鹅绒（canada goose）\",\"initialId\":1003,\"initialCode\":\"C\",\"consumerId\":101,\"sort\":1},{\"name\":\"雪铁纳（Certina）\",\"initialId\":1003,\"initialCode\":\"C\",\"consumerId\":101,\"sort\":1},{\"name\":\"萧邦（Chopard）\",\"initialId\":1003,\"initialCode\":\"C\",\"consumerId\":101,\"sort\":1},{\"name\":\"Carl F.Bucherer\",\"initialId\":1003,\"initialCode\":\"C\",\"consumerId\":101,\"sort\":1}]},{\"name\":\"D\",\"consumerId\":101,\"sort\":4,\"brandList\":[{\"name\":\"Delvaux\",\"initialId\":1004,\"initialCode\":\"D\",\"consumerId\":101,\"sort\":0},{\"name\":\"DE BEERS\",\"initialId\":1004,\"initialCode\":\"D\",\"consumerId\":101,\"sort\":0},{\"name\":\"迪奥（Dior）\",\"initialId\":1004,\"initialCode\":\"D\",\"consumerId\":101,\"sort\":1},{\"name\":\"大卫杜夫（DAVIDOFF）\",\"initialId\":1004,\"initialCode\":\"D\",\"consumerId\":101,\"sort\":1},{\"name\":\"DVF\",\"initialId\":1004,\"initialCode\":\"D\",\"consumerId\":101,\"sort\":1}]},{\"name\":\"E\",\"consumerId\":101,\"sort\":4,\"brandList\":[{\"name\":\"ETRO\",\"initialId\":1005,\"initialCode\":\"E\",\"consumerId\":101,\"sort\":1},{\"name\":\"Emporio Armani腕表\",\"initialId\":1005,\"initialCode\":\"E\",\"consumerId\":101,\"sort\":1}]},{\"name\":\"F\",\"consumerId\":101,\"sort\":4,\"brandList\":[{\"name\":\"FENDI\",\"initialId\":1006,\"initialCode\":\"F\",\"consumerId\":101,\"sort\":1},{\"name\":\"菲拉格慕（Ferragamo）\",\"initialId\":1006,\"initialCode\":\"F\",\"consumerId\":101,\"sort\":1},{\"name\":\"FRED\",\"initialId\":1006,\"initialCode\":\"F\",\"consumerId\":101,\"sort\":1}]},{\"name\":\"G\",\"consumerId\":101,\"sort\":4,\"brandList\":[{\"name\":\"GUCCI\",\"initialId\":1007,\"initialCode\":\"G\",\"consumerId\":101,\"sort\":0},{\"name\":\"GENTLE MONSTER\",\"initialId\":1007,\"initialCode\":\"G\",\"consumerId\":101,\"sort\":0},{\"name\":\"君皇仕（GIEVES & HAWKES）\",\"initialId\":1007,\"initialCode\":\"G\",\"consumerId\":101,\"sort\":0},{\"name\":\"GUIDI\",\"initialId\":1007,\"initialCode\":\"G\",\"consumerId\":101,\"sort\":0},{\"name\":\"国色丰瑶\",\"initialId\":1007,\"initialCode\":\"G\",\"consumerId\":101,\"sort\":0},{\"name\":\"纪梵希（Givenchy）\",\"initialId\":1007,\"initialCode\":\"G\",\"consumerId\":101,\"sort\":1},{\"name\":\"Giuseppe Zanotti\",\"initialId\":1007,\"initialCode\":\"G\",\"consumerId\":101,\"sort\":1},{\"name\":\"迦堤（Galtiscopio）\",\"initialId\":1007,\"initialCode\":\"G\",\"consumerId\":101,\"sort\":1},{\"name\":\"Golden Goose\",\"initialId\":1007,\"initialCode\":\"G\",\"consumerId\":101,\"sort\":1},{\"name\":\"GOOSSENS\",\"initialId\":1007,\"initialCode\":\"G\",\"consumerId\":101,\"sort\":1},{\"name\":\"GAS BIJOUX\",\"initialId\":1007,\"initialCode\":\"G\",\"consumerId\":101,\"sort\":1}]},{\"name\":\"H\",\"consumerId\":101,\"sort\":4,\"brandList\":[{\"name\":\"雨果博斯（HUGO BOSS）\",\"initialId\":1008,\"initialCode\":\"H\",\"consumerId\":101,\"sort\":1},{\"name\":\"霍根（HOGAN）\",\"initialId\":1008,\"initialCode\":\"H\",\"consumerId\":101,\"sort\":1},{\"name\":\"汉米尔顿（Hamilton）\",\"initialId\":1008,\"initialCode\":\"H\",\"consumerId\":101,\"sort\":1}]},{\"name\":\"I\",\"consumerId\":101,\"sort\":4,\"brandList\":[{\"name\":\"万国（IWC）\",\"initialId\":1009,\"initialCode\":\"I\",\"consumerId\":101,\"sort\":0},{\"name\":\"Issey Miyake\",\"initialId\":1009,\"initialCode\":\"I\",\"consumerId\":101,\"sort\":1}]},{\"name\":\"J\",\"consumerId\":101,\"sort\":4,\"brandList\":[{\"name\":\"周仰杰（Jimmy Choo）\",\"initialId\":1010,\"initialCode\":\"J\",\"consumerId\":101,\"sort\":1},{\"name\":\"JOHN LOBB\",\"initialId\":1010,\"initialCode\":\"J\",\"consumerId\":101,\"sort\":1},{\"name\":\"JW ANDERSON\",\"initialId\":1010,\"initialCode\":\"J\",\"consumerId\":101,\"sort\":1}]},{\"name\":\"K\",\"consumerId\":101,\"sort\":4,\"brandList\":[{\"name\":\"KENT&CURWEN\",\"initialId\":1011,\"initialCode\":\"K\",\"consumerId\":101,\"sort\":1},{\"name\":\"可艾琳（K&IRENE）\",\"initialId\":1011,\"initialCode\":\"K\",\"consumerId\":101,\"sort\":1},{\"name\":\"高田贤三（KENZO）\",\"initialId\":1011,\"initialCode\":\"K\",\"consumerId\":101,\"sort\":1}]},{\"name\":\"L\",\"consumerId\":101,\"sort\":4,\"brandList\":[{\"name\":\"lanvin\",\"initialId\":1012,\"initialCode\":\"L\",\"consumerId\":101,\"sort\":0},{\"name\":\"路易威登（LV）\",\"initialId\":1012,\"initialCode\":\"L\",\"consumerId\":101,\"sort\":1},{\"name\":\"LOEWE\",\"initialId\":1012,\"initialCode\":\"L\",\"consumerId\":101,\"sort\":1},{\"name\":\"宝娜（La Perla）\",\"initialId\":1012,\"initialCode\":\"L\",\"consumerId\":101,\"sort\":1},{\"name\":\"珑骧（LONGCHAMP）\",\"initialId\":1012,\"initialCode\":\"L\",\"consumerId\":101,\"sort\":1},{\"name\":\"LANCEL\",\"initialId\":1012,\"initialCode\":\"L\",\"consumerId\":101,\"sort\":1}]},{\"name\":\"M\",\"consumerId\":101,\"sort\":4,\"brandList\":[{\"name\":\"莫杰（MARC JACOBS）\",\"initialId\":1013,\"initialCode\":\"M\",\"consumerId\":101,\"sort\":0},{\"name\":\"Maison Margiela\",\"initialId\":1013,\"initialCode\":\"M\",\"consumerId\":101,\"sort\":0},{\"name\":\"MONTBLANC\",\"initialId\":1013,\"initialCode\":\"M\",\"consumerId\":101,\"sort\":1},{\"name\":\"MCM\",\"initialId\":1013,\"initialCode\":\"M\",\"consumerId\":101,\"sort\":1},{\"name\":\"莫斯奇诺（MOSCHINO）\",\"initialId\":1013,\"initialCode\":\"M\",\"consumerId\":101,\"sort\":1},{\"name\":\"Mulberry\",\"initialId\":1013,\"initialCode\":\"M\",\"consumerId\":101,\"sort\":1},{\"name\":\"moneta\",\"initialId\":1013,\"initialCode\":\"M\",\"consumerId\":101,\"sort\":1},{\"name\":\"MANU ATELIER\",\"initialId\":1013,\"initialCode\":\"M\",\"consumerId\":101,\"sort\":1},{\"name\":\"MANITO\",\"initialId\":1013,\"initialCode\":\"M\",\"consumerId\":101,\"sort\":1},{\"name\":\"MK\",\"initialId\":1013,\"initialCode\":\"M\",\"consumerId\":101,\"sort\":1},{\"name\":\"MAX MARA\",\"initialId\":1013,\"initialCode\":\"M\",\"consumerId\":101,\"sort\":1},{\"name\":\"MISSONI\",\"initialId\":1013,\"initialCode\":\"M\",\"consumerId\":101,\"sort\":1},{\"name\":\"Maison Kitsune\",\"initialId\":1013,\"initialCode\":\"M\",\"consumerId\":101,\"sort\":1},{\"name\":\"缪缪（MiuMiu）\",\"initialId\":1013,\"initialCode\":\"M\",\"consumerId\":101,\"sort\":1}]},{\"name\":\"O\",\"consumerId\":101,\"sort\":4,\"brandList\":[{\"name\":\"欧米茄（OMEGA）\",\"initialId\":1015,\"initialCode\":\"O\",\"consumerId\":101,\"sort\":1}]},{\"name\":\"P\",\"consumerId\":101,\"sort\":4,\"brandList\":[{\"name\":\"PINKO\",\"initialId\":1016,\"initialCode\":\"P\",\"consumerId\":101,\"sort\":1},{\"name\":\"保罗史密斯（paul smith）\",\"initialId\":1016,\"initialCode\":\"P\",\"consumerId\":101,\"sort\":1},{\"name\":\"PHILIPP PLEIN\",\"initialId\":1016,\"initialCode\":\"P\",\"consumerId\":101,\"sort\":1},{\"name\":\"Pourchet\",\"initialId\":1016,\"initialCode\":\"P\",\"consumerId\":101,\"sort\":1},{\"name\":\"PRADA\",\"initialId\":1016,\"initialCode\":\"P\",\"consumerId\":101,\"sort\":1},{\"name\":\"POLINA\",\"initialId\":1016,\"initialCode\":\"P\",\"consumerId\":101,\"sort\":1}]},{\"name\":\"Q\",\"consumerId\":101,\"sort\":4,\"brandList\":[{\"name\":\"QEELIN\",\"initialId\":1017,\"initialCode\":\"Q\",\"consumerId\":101,\"sort\":1},{\"name\":\"安妮女王（QUEEN ANNE）\",\"initialId\":1017,\"initialCode\":\"Q\",\"consumerId\":101,\"sort\":1}]},{\"name\":\"R\",\"consumerId\":101,\"sort\":4,\"brandList\":[{\"name\":\"Ralph Lauren\",\"initialId\":1018,\"initialCode\":\"R\",\"consumerId\":101,\"sort\":1},{\"name\":\"ROSANTICA\",\"initialId\":1018,\"initialCode\":\"R\",\"consumerId\":101,\"sort\":1},{\"name\":\"RV\",\"initialId\":1018,\"initialCode\":\"R\",\"consumerId\":101,\"sort\":1},{\"name\":\"RIMOWA\",\"initialId\":1018,\"initialCode\":\"R\",\"consumerId\":101,\"sort\":1}]},{\"name\":\"S\",\"consumerId\":101,\"sort\":4,\"brandList\":[{\"name\":\"SERGIO ROSSI\",\"initialId\":1019,\"initialCode\":\"S\",\"consumerId\":101,\"sort\":0},{\"name\":\"Stuart Weitzman\",\"initialId\":1019,\"initialCode\":\"S\",\"consumerId\":101,\"sort\":1},{\"name\":\"S.T.Dupont\",\"initialId\":1019,\"initialCode\":\"S\",\"consumerId\":101,\"sort\":1},{\"name\":\"SENREVE\",\"initialId\":1019,\"initialCode\":\"S\",\"consumerId\":101,\"sort\":1},{\"name\":\"sheme\",\"initialId\":1019,\"initialCode\":\"S\",\"consumerId\":101,\"sort\":1},{\"name\":\"SILKY MIRACLE\",\"initialId\":1019,\"initialCode\":\"S\",\"consumerId\":101,\"sort\":1},{\"name\":\"上下（SHANG XIA）\",\"initialId\":1019,\"initialCode\":\"S\",\"consumerId\":101,\"sort\":1},{\"name\":\"SHINE LI\",\"initialId\":1019,\"initialCode\":\"S\",\"consumerId\":101,\"sort\":1}]},{\"name\":\"T\",\"consumerId\":101,\"sort\":4,\"brandList\":[{\"name\":\"TIFFANY\",\"initialId\":1020,\"initialCode\":\"T\",\"consumerId\":101,\"sort\":1},{\"name\":\"托德斯（TOD'S ）\",\"initialId\":1020,\"initialCode\":\"T\",\"consumerId\":101,\"sort\":1},{\"name\":\"泰格豪雅\",\"initialId\":1020,\"initialCode\":\"T\",\"consumerId\":101,\"sort\":1},{\"name\":\"TORY BURCH\",\"initialId\":1020,\"initialCode\":\"T\",\"consumerId\":101,\"sort\":1}]},{\"name\":\"U\",\"consumerId\":101,\"sort\":4,\"brandList\":[{\"name\":\"union\",\"initialId\":1021,\"initialCode\":\"U\",\"consumerId\":101,\"sort\":1}]},{\"name\":\"V\",\"consumerId\":101,\"sort\":4,\"brandList\":[{\"name\":\"veja\",\"initialId\":1022,\"initialCode\":\"V\",\"consumerId\":101,\"sort\":0},{\"name\":\"华伦天奴（Valentino）\",\"initialId\":1022,\"initialCode\":\"V\",\"consumerId\":101,\"sort\":1},{\"name\":\"范思哲（VERSACE）\",\"initialId\":1022,\"initialCode\":\"V\",\"consumerId\":101,\"sort\":1},{\"name\":\"薇薇安·威斯特伍德（Vivienne Westwood）\",\"initialId\":1022,\"initialCode\":\"V\",\"consumerId\":101,\"sort\":1}]},{\"name\":\"Z\",\"consumerId\":101,\"sort\":4,\"brandList\":[{\"name\":\"ZEGNA\",\"initialId\":1026,\"initialCode\":\"Z\",\"consumerId\":101,\"sort\":1},{\"name\":\"ZENITH\",\"initialId\":1026,\"initialCode\":\"Z\",\"consumerId\":101,\"sort\":1},{\"name\":\"ZADIG&VOLTAIRE\",\"initialId\":1026,\"initialCode\":\"Z\",\"consumerId\":101,\"sort\":1}]}]},{\"id\":102,\"name\":\"男士\",\"sort\":2,\"initialList\":[{\"name\":\"A\",\"consumerId\":102,\"sort\":1,\"brandList\":[{\"name\":\"A-COLD-WALL*\",\"initialId\":2001,\"initialCode\":\"A\",\"consumerId\":102,\"sort\":1},{\"name\":\"Alexandre De Paris\",\"initialId\":2001,\"initialCode\":\"A\",\"consumerId\":102,\"sort\":1},{\"name\":\"APEDE MOD\",\"initialId\":2001,\"initialCode\":\"A\",\"consumerId\":102,\"sort\":1},{\"name\":\"ARMANI EXCHANGE\",\"initialId\":2001,\"initialCode\":\"A\",\"consumerId\":102,\"sort\":1},{\"name\":\"ANTEPRIMA\",\"initialId\":2001,\"initialCode\":\"A\",\"consumerId\":102,\"sort\":1},{\"name\":\"ACNE STUDIOS\",\"initialId\":2001,\"initialCode\":\"A\",\"consumerId\":102,\"sort\":1}]},{\"name\":\"B\",\"consumerId\":102,\"sort\":2,\"brandList\":[{\"name\":\"BVLGARI\",\"initialId\":2002,\"initialCode\":\"B\",\"consumerId\":102,\"sort\":1},{\"name\":\"BERLUTI\",\"initialId\":2002,\"initialCode\":\"B\",\"consumerId\":102,\"sort\":1},{\"name\":\"BURBERRY\",\"initialId\":2002,\"initialCode\":\"B\",\"consumerId\":102,\"sort\":1},{\"name\":\"BALENCIAGA\",\"initialId\":2002,\"initialCode\":\"B\",\"consumerId\":102,\"sort\":1},{\"name\":\"BALLY\",\"initialId\":2002,\"initialCode\":\"B\",\"consumerId\":102,\"sort\":1},{\"name\":\"BE@RBRICK\",\"initialId\":2002,\"initialCode\":\"B\",\"consumerId\":102,\"sort\":1},{\"name\":\"布克兄弟(BROOKS BROTHERS)\",\"initialId\":2002,\"initialCode\":\"B\",\"consumerId\":102,\"sort\":1},{\"name\":\"BACCARAT\",\"initialId\":2002,\"initialCode\":\"B\",\"consumerId\":102,\"sort\":1},{\"name\":\"BV\",\"initialId\":2002,\"initialCode\":\"B\",\"consumerId\":102,\"sort\":1},{\"name\":\"BUBEN & ZORWEG\",\"initialId\":2002,\"initialCode\":\"B\",\"consumerId\":102,\"sort\":1}]},{\"name\":\"C\",\"consumerId\":102,\"sort\":3,\"brandList\":[{\"name\":\"CARRIERE FRERES\",\"initialId\":2003,\"initialCode\":\"C\",\"consumerId\":102,\"sort\":0},{\"name\":\"卡地亚（Cartier）\",\"initialId\":2003,\"initialCode\":\"C\",\"consumerId\":102,\"sort\":0},{\"name\":\"culti\",\"initialId\":2003,\"initialCode\":\"C\",\"consumerId\":102,\"sort\":0},{\"name\":\"celine\",\"initialId\":2003,\"initialCode\":\"C\",\"consumerId\":102,\"sort\":1},{\"name\":\"卓诺迪（Cerruti 1881）\",\"initialId\":2003,\"initialCode\":\"C\",\"consumerId\":102,\"sort\":1},{\"name\":\"昆仑表（CORUM）\",\"initialId\":2003,\"initialCode\":\"C\",\"consumerId\":102,\"sort\":1},{\"name\":\"蔻驰（COACH）\",\"initialId\":2003,\"initialCode\":\"C\",\"consumerId\":102,\"sort\":1},{\"name\":\"加拿大鹅绒（canada goose）\",\"initialId\":2003,\"initialCode\":\"C\",\"consumerId\":102,\"sort\":1},{\"name\":\"雪铁纳（Certina）\",\"initialId\":2003,\"initialCode\":\"C\",\"consumerId\":102,\"sort\":1},{\"name\":\"萧邦（Chopard）\",\"initialId\":2003,\"initialCode\":\"C\",\"consumerId\":102,\"sort\":1},{\"name\":\"Carl F.Bucherer\",\"initialId\":2003,\"initialCode\":\"C\",\"consumerId\":102,\"sort\":1}]},{\"name\":\"D\",\"consumerId\":102,\"sort\":4,\"brandList\":[{\"name\":\"Delvaux\",\"initialId\":2004,\"initialCode\":\"D\",\"consumerId\":102,\"sort\":0},{\"name\":\"DE BEERS\",\"initialId\":2004,\"initialCode\":\"D\",\"consumerId\":102,\"sort\":0},{\"name\":\"迪奥（Dior）\",\"initialId\":2004,\"initialCode\":\"D\",\"consumerId\":102,\"sort\":1},{\"name\":\"大卫杜夫（DAVIDOFF）\",\"initialId\":2004,\"initialCode\":\"D\",\"consumerId\":102,\"sort\":1},{\"name\":\"DVF\",\"initialId\":2004,\"initialCode\":\"D\",\"consumerId\":102,\"sort\":1}]},{\"name\":\"E\",\"consumerId\":102,\"sort\":4,\"brandList\":[{\"name\":\"ETRO\",\"initialId\":2005,\"initialCode\":\"E\",\"consumerId\":102,\"sort\":1},{\"name\":\"Emporio Armani腕表\",\"initialId\":2005,\"initialCode\":\"E\",\"consumerId\":102,\"sort\":1}]},{\"name\":\"F\",\"consumerId\":102,\"sort\":4,\"brandList\":[{\"name\":\"FENDI\",\"initialId\":2006,\"initialCode\":\"F\",\"consumerId\":102,\"sort\":1},{\"name\":\"菲拉格慕（Ferragamo）\",\"initialId\":2006,\"initialCode\":\"F\",\"consumerId\":102,\"sort\":1},{\"name\":\"FRED\",\"initialId\":2006,\"initialCode\":\"F\",\"consumerId\":102,\"sort\":1}]},{\"name\":\"G\",\"consumerId\":102,\"sort\":4,\"brandList\":[{\"name\":\"GUCCI\",\"initialId\":2007,\"initialCode\":\"G\",\"consumerId\":102,\"sort\":0},{\"name\":\"GENTLE MONSTER\",\"initialId\":2007,\"initialCode\":\"G\",\"consumerId\":102,\"sort\":0},{\"name\":\"君皇仕（GIEVES & HAWKES）\",\"initialId\":2007,\"initialCode\":\"G\",\"consumerId\":102,\"sort\":0},{\"name\":\"GUIDI\",\"initialId\":2007,\"initialCode\":\"G\",\"consumerId\":102,\"sort\":0},{\"name\":\"国色丰瑶\",\"initialId\":2007,\"initialCode\":\"G\",\"consumerId\":102,\"sort\":0},{\"name\":\"纪梵希（Givenchy）\",\"initialId\":2007,\"initialCode\":\"G\",\"consumerId\":102,\"sort\":1},{\"name\":\"Giuseppe Zanotti\",\"initialId\":2007,\"initialCode\":\"G\",\"consumerId\":102,\"sort\":1},{\"name\":\"迦堤（Galtiscopio）\",\"initialId\":2007,\"initialCode\":\"G\",\"consumerId\":102,\"sort\":1},{\"name\":\"Golden Goose\",\"initialId\":2007,\"initialCode\":\"G\",\"consumerId\":102,\"sort\":1},{\"name\":\"GOOSSENS\",\"initialId\":2007,\"initialCode\":\"G\",\"consumerId\":102,\"sort\":1},{\"name\":\"GAS BIJOUX\",\"initialId\":2007,\"initialCode\":\"G\",\"consumerId\":102,\"sort\":1}]},{\"name\":\"H\",\"consumerId\":102,\"sort\":4,\"brandList\":[{\"name\":\"雨果博斯（HUGO BOSS）\",\"initialId\":2008,\"initialCode\":\"H\",\"consumerId\":102,\"sort\":1},{\"name\":\"霍根（HOGAN）\",\"initialId\":2008,\"initialCode\":\"H\",\"consumerId\":102,\"sort\":1},{\"name\":\"汉米尔顿（Hamilton）\",\"initialId\":2008,\"initialCode\":\"H\",\"consumerId\":102,\"sort\":1}]},{\"name\":\"I\",\"consumerId\":102,\"sort\":4,\"brandList\":[{\"name\":\"万国（IWC）\",\"initialId\":2009,\"initialCode\":\"I\",\"consumerId\":102,\"sort\":0},{\"name\":\"Issey Miyake\",\"initialId\":2009,\"initialCode\":\"I\",\"consumerId\":102,\"sort\":1}]},{\"name\":\"J\",\"consumerId\":102,\"sort\":4,\"brandList\":[{\"name\":\"周仰杰（Jimmy Choo）\",\"initialId\":2010,\"initialCode\":\"J\",\"consumerId\":102,\"sort\":1},{\"name\":\"JOHN LOBB\",\"initialId\":2010,\"initialCode\":\"J\",\"consumerId\":102,\"sort\":1},{\"name\":\"JW ANDERSON\",\"initialId\":2010,\"initialCode\":\"J\",\"consumerId\":102,\"sort\":1}]},{\"name\":\"K\",\"consumerId\":102,\"sort\":4,\"brandList\":[{\"name\":\"KENT&CURWEN\",\"initialId\":2011,\"initialCode\":\"K\",\"consumerId\":102,\"sort\":1},{\"name\":\"可艾琳（K&IRENE）\",\"initialId\":2011,\"initialCode\":\"K\",\"consumerId\":102,\"sort\":1},{\"name\":\"高田贤三（KENZO）\",\"initialId\":2011,\"initialCode\":\"K\",\"consumerId\":102,\"sort\":1}]},{\"name\":\"L\",\"consumerId\":102,\"sort\":4,\"brandList\":[{\"name\":\"lanvin\",\"initialId\":2012,\"initialCode\":\"L\",\"consumerId\":102,\"sort\":0},{\"name\":\"路易威登（LV）\",\"initialId\":2012,\"initialCode\":\"L\",\"consumerId\":102,\"sort\":1},{\"name\":\"LOEWE\",\"initialId\":2012,\"initialCode\":\"L\",\"consumerId\":102,\"sort\":1},{\"name\":\"宝娜（La Perla）\",\"initialId\":2012,\"initialCode\":\"L\",\"consumerId\":102,\"sort\":1},{\"name\":\"珑骧（LONGCHAMP）\",\"initialId\":2012,\"initialCode\":\"L\",\"consumerId\":102,\"sort\":1},{\"name\":\"LANCEL\",\"initialId\":2012,\"initialCode\":\"L\",\"consumerId\":102,\"sort\":1}]},{\"name\":\"M\",\"consumerId\":102,\"sort\":4,\"brandList\":[{\"name\":\"莫杰（MARC JACOBS）\",\"initialId\":2013,\"initialCode\":\"M\",\"consumerId\":102,\"sort\":0},{\"name\":\"Maison Margiela\",\"initialId\":2013,\"initialCode\":\"M\",\"consumerId\":102,\"sort\":0},{\"name\":\"MONTBLANC\",\"initialId\":2013,\"initialCode\":\"M\",\"consumerId\":102,\"sort\":1},{\"name\":\"MCM\",\"initialId\":2013,\"initialCode\":\"M\",\"consumerId\":102,\"sort\":1},{\"name\":\"莫斯奇诺（MOSCHINO）\",\"initialId\":2013,\"initialCode\":\"M\",\"consumerId\":102,\"sort\":1},{\"name\":\"Mulberry\",\"initialId\":2013,\"initialCode\":\"M\",\"consumerId\":102,\"sort\":1},{\"name\":\"moneta\",\"initialId\":2013,\"initialCode\":\"M\",\"consumerId\":102,\"sort\":1},{\"name\":\"MANU ATELIER\",\"initialId\":2013,\"initialCode\":\"M\",\"consumerId\":102,\"sort\":1},{\"name\":\"MANITO\",\"initialId\":2013,\"initialCode\":\"M\",\"consumerId\":102,\"sort\":1},{\"name\":\"MK\",\"initialId\":2013,\"initialCode\":\"M\",\"consumerId\":102,\"sort\":1},{\"name\":\"MAX MARA\",\"initialId\":2013,\"initialCode\":\"M\",\"consumerId\":102,\"sort\":1},{\"name\":\"MISSONI\",\"initialId\":2013,\"initialCode\":\"M\",\"consumerId\":102,\"sort\":1},{\"name\":\"Maison Kitsune\",\"initialId\":2013,\"initialCode\":\"M\",\"consumerId\":102,\"sort\":1},{\"name\":\"缪缪（MiuMiu）\",\"initialId\":2013,\"initialCode\":\"M\",\"consumerId\":102,\"sort\":1}]},{\"name\":\"O\",\"consumerId\":102,\"sort\":4,\"brandList\":[{\"name\":\"欧米茄（OMEGA）\",\"initialId\":2015,\"initialCode\":\"O\",\"consumerId\":102,\"sort\":1}]},{\"name\":\"P\",\"consumerId\":102,\"sort\":4,\"brandList\":[{\"name\":\"PINKO\",\"initialId\":2016,\"initialCode\":\"P\",\"consumerId\":102,\"sort\":1},{\"name\":\"保罗史密斯（paul smith）\",\"initialId\":2016,\"initialCode\":\"P\",\"consumerId\":102,\"sort\":1},{\"name\":\"PHILIPP PLEIN\",\"initialId\":2016,\"initialCode\":\"P\",\"consumerId\":102,\"sort\":1},{\"name\":\"Pourchet\",\"initialId\":2016,\"initialCode\":\"P\",\"consumerId\":102,\"sort\":1},{\"name\":\"PRADA\",\"initialId\":2016,\"initialCode\":\"P\",\"consumerId\":102,\"sort\":1},{\"name\":\"POLINA\",\"initialId\":2016,\"initialCode\":\"P\",\"consumerId\":102,\"sort\":1}]},{\"name\":\"Q\",\"consumerId\":102,\"sort\":4,\"brandList\":[{\"name\":\"QEELIN\",\"initialId\":2017,\"initialCode\":\"Q\",\"consumerId\":102,\"sort\":1},{\"name\":\"安妮女王（QUEEN ANNE）\",\"initialId\":2017,\"initialCode\":\"Q\",\"consumerId\":102,\"sort\":1}]},{\"name\":\"R\",\"consumerId\":102,\"sort\":4,\"brandList\":[{\"name\":\"Ralph Lauren\",\"initialId\":2018,\"initialCode\":\"R\",\"consumerId\":102,\"sort\":1},{\"name\":\"ROSANTICA\",\"initialId\":2018,\"initialCode\":\"R\",\"consumerId\":102,\"sort\":1},{\"name\":\"RV\",\"initialId\":2018,\"initialCode\":\"R\",\"consumerId\":102,\"sort\":1},{\"name\":\"RIMOWA\",\"initialId\":2018,\"initialCode\":\"R\",\"consumerId\":102,\"sort\":1}]},{\"name\":\"S\",\"consumerId\":102,\"sort\":4,\"brandList\":[{\"name\":\"SERGIO ROSSI\",\"initialId\":2019,\"initialCode\":\"S\",\"consumerId\":102,\"sort\":0},{\"name\":\"Stuart Weitzman\",\"initialId\":2019,\"initialCode\":\"S\",\"consumerId\":102,\"sort\":1},{\"name\":\"S.T.Dupont\",\"initialId\":2019,\"initialCode\":\"S\",\"consumerId\":102,\"sort\":1},{\"name\":\"SENREVE\",\"initialId\":2019,\"initialCode\":\"S\",\"consumerId\":102,\"sort\":1},{\"name\":\"sheme\",\"initialId\":2019,\"initialCode\":\"S\",\"consumerId\":102,\"sort\":1},{\"name\":\"SILKY MIRACLE\",\"initialId\":2019,\"initialCode\":\"S\",\"consumerId\":102,\"sort\":1},{\"name\":\"上下（SHANG XIA）\",\"initialId\":2019,\"initialCode\":\"S\",\"consumerId\":102,\"sort\":1},{\"name\":\"SHINE LI\",\"initialId\":2019,\"initialCode\":\"S\",\"consumerId\":102,\"sort\":1}]},{\"name\":\"T\",\"consumerId\":102,\"sort\":4,\"brandList\":[{\"name\":\"TIFFANY\",\"initialId\":2020,\"initialCode\":\"T\",\"consumerId\":102,\"sort\":1},{\"name\":\"托德斯（TOD'S ）\",\"initialId\":2020,\"initialCode\":\"T\",\"consumerId\":102,\"sort\":1},{\"name\":\"泰格豪雅\",\"initialId\":2020,\"initialCode\":\"T\",\"consumerId\":102,\"sort\":1},{\"name\":\"TORY BURCH\",\"initialId\":2020,\"initialCode\":\"T\",\"consumerId\":102,\"sort\":1}]},{\"name\":\"U\",\"consumerId\":102,\"sort\":4,\"brandList\":[{\"name\":\"union\",\"initialId\":2021,\"initialCode\":\"U\",\"consumerId\":102,\"sort\":1}]},{\"name\":\"V\",\"consumerId\":102,\"sort\":4,\"brandList\":[{\"name\":\"华伦天奴（Valentino）\",\"initialId\":2022,\"initialCode\":\"V\",\"consumerId\":102,\"sort\":1},{\"name\":\"范思哲（VERSACE）\",\"initialId\":2022,\"initialCode\":\"V\",\"consumerId\":102,\"sort\":1}]},{\"name\":\"Z\",\"consumerId\":102,\"sort\":4,\"brandList\":[{\"name\":\"ZENITH\",\"initialId\":2026,\"initialCode\":\"Z\",\"consumerId\":102,\"sort\":1},{\"name\":\"ZADIG&VOLTAIRE\",\"initialId\":2026,\"initialCode\":\"Z\",\"consumerId\":102,\"sort\":1}]}]}]";
        List<ConsumerPO> consumerList = JSON.parseArray(brandJson, ConsumerPO.class);
        for (ConsumerPO consumer : consumerList) {
            List<InitialPO> initials = consumer.getInitialList();
            for (InitialPO initial : initials) {
                //遍历，收藏标识 赋值
                for (BrandPO brandVO : initial.getBrandList()) {
//                        String hanzi = "布克兄弟(BROOKS BROTHERS)";
                    String pinYinCode = getPinYinCode(brandVO.getName());
                    System.out.println("======"+pinYinCode+"======"); // 输出拼音结果
                }
            }
        }
    }

    private String getPinYinCode(String brandName){
        // 设置输出格式
        HanyuPinyinOutputFormat format = new HanyuPinyinOutputFormat();
//      format.setCaseType(HanyuPinyinCaseType.UPPERCASE);
        format.setToneType(HanyuPinyinToneType.WITHOUT_TONE);
        StringBuilder result = new StringBuilder();
        try {
            for (char c : brandName.toCharArray()) {
                // 转换每个汉字为拼音
                String[] pinyinArray = PinyinHelper.toHanyuPinyinStringArray(c, format);
                // 将拼音结果拼接起来
                if (pinyinArray != null && pinyinArray.length > 0) {
                    result.append(pinyinArray[0]);
                } else {
                    result.append(c);
                }
            }
        } catch (BadHanyuPinyinOutputFormatCombination e) {
            e.printStackTrace();
        } catch (Exception e) {
            e.printStackTrace();
        }
        String englishCode = result.toString();
        //        System.out.println(englishCode); // 输出拼音结果
        return englishCode;
    }
}
